#ifndef __BITMAP_H
#define __BITMAP_H
#include "stdtype.h"

/* get the lowest bit 1 in mx_uint8_t */
#define bitmap_lsbidx8(dat) (bitmap_lowest[dat])
/* get the highest bit 1 in mx_uint8_t */
#define bitmap_msbidx8(dat) (bitmap_highest[dat])

/* bitmap for lowest bit 1 (byte=0 is illegal import) */
extern const mx_uint8_t bitmap_lowest[256];
/* bitmap for highest bit 1 (byte=0 is illegal import) */
extern const mx_uint8_t bitmap_highest[256];

/* get the lowest bit 1 in mx_uint16_t */
mx_uint8_t bitmap_lsbidx16 (mx_uint16_t dat);
/* get the lowest bit 1 in mx_uint32_t */
mx_uint8_t bitmap_lsbidx32 (mx_uint32_t dat);
/* get the lowest bit 1 in mx_uint64_t */
mx_uint8_t bitmap_lsbidx64 (mx_uint64_t dat);
/* get the highest bit 1 in mx_uint16_t */
mx_uint8_t bitmap_msbidx16 (mx_uint16_t dat);
/* get the highest bit 1 in mx_uint32_t */
mx_uint8_t bitmap_msbidx32 (mx_uint32_t dat);
/* get the highest bit 1 in mx_uint64_t */
mx_uint8_t bitmap_msbidx64 (mx_uint64_t dat);

#endif
